<title>管理员</title>
<div class="layui-fluid">

    <script type="text/html" id="toolbar">
        <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm save" data-title="添加管理员" data-url="/admin/save"> 添加管理员 </button>
        </div>
    </script>

    <table class="layui-hide" id="admin-list" lay-filter="admin-list"></table>

    <script type="text/html" id="admin_bar">
        <a class="layui-btn layui-btn-xs save" data-title="编辑管理员" data-url="/admin/save" data-id='{{ d.id }}'>编辑</a>
        <a class="layui-btn layui-btn-xs layui-btn-danger delete" data-url="admin/admin/delete/id/{{ d.id }}">删除</a>
    </script>

</div>
<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;

        var tableIns = table.render({
            elem: '#admin-list',
            url: layui.setter.API_HOST + '/admin/admin/index',
            toolbar: '#toolbar',
            cols: [[
                {field: 'id', width: 80, title: 'ID', sort: true},
                {field: 'username', width: 120, title: '用户名'},
                {field: 'nickname', width: 150, title: '昵称'},
                {field: 'status_text', width: 135, title: '状态'},
                {field: 'roles_name', width: 335, title: '角色'},
                {title: '操作', templet: '#admin_bar'}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true
        });
    });
</script>